<?php
/**
 * Minhlog 分类边栏视图助手
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 *
 * @category   View_Helper
 * @package    Minh_View_Helper
 * @copyright  Copyright (c) 2009-2010 Minh.Shu Minh.Shu@gmail.com
 * @license    New BSD License
 * @author     Minh.Shu
 * @version    $Id: CategorySideBar.php 32 2010-03-30 12:40:08Z minh.shu $
 * @uses        Zend_View_Helper
 */

class Minh_View_Helper_CategorySideBar extends Minh_View_Helper_SideBarAbstract
{
    public function categorySideBar ()
    {
        $cacheId = md5('categorySideBar');
        if (! ($categorySideBarCache = $this->cache->load($cacheId))) {
            $categorySideBar = array();
            $categoryModel = new Domain_Model_Category();
            $categorySideBar = $categoryModel->getCategoryTree();
            if(null === $categorySideBar){
                $categorySideBar = array();
            } else {
                $this->cache->save($categorySideBar, $cacheId);
            }
        } else {
            $categorySideBar = $categorySideBarCache;
        }
        return $categorySideBar;
    }
}